package com.htgd.gardenexpo.service.impl;

import com.htgd.gardenexpo.entity.GeConTouristTrafficFeedback;
import com.htgd.gardenexpo.dao.GeConTouristTrafficFeedbackDao;
import com.htgd.gardenexpo.service.GeConTouristTrafficFeedbackService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * (GeConTouristTrafficFeedback)表服务实现类
 *
 * @author makejava
 * @since 2021-06-09 14:07:53
 */
@Service("geConTouristTrafficFeedbackService")
public class GeConTouristTrafficFeedbackServiceImpl implements GeConTouristTrafficFeedbackService {
    @Resource
    private GeConTouristTrafficFeedbackDao geConTouristTrafficFeedbackDao;

    /**
     * 通过ID查询单条数据
     *
     * @param 主键
     * @return 实例对象
     */
    @Override
    public GeConTouristTrafficFeedback queryById() {
        return this.geConTouristTrafficFeedbackDao.queryById();
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit  查询条数
     * @return 对象列表
     */
    @Override
    public List<GeConTouristTrafficFeedback> queryAllByLimit(int offset, int limit) {
        return this.geConTouristTrafficFeedbackDao.queryAllByLimit(offset, limit);
    }

    @Override
    public List<GeConTouristTrafficFeedback> getinfoByTrafficId(int id) {
        return this.geConTouristTrafficFeedbackDao.getinfoByTrafficId(id);
    }

    /**
     * 新增数据
     *
     * @param geConTouristTrafficFeedback 实例对象
     * @return 实例对象
     */
    @Override
    public GeConTouristTrafficFeedback insert(GeConTouristTrafficFeedback geConTouristTrafficFeedback) {
        this.geConTouristTrafficFeedbackDao.insert(geConTouristTrafficFeedback);
        return geConTouristTrafficFeedback;
    }

    /**
     * 修改数据
     *
     * @param geConTouristTrafficFeedback 实例对象
     * @return 实例对象
     */
    @Override
    public GeConTouristTrafficFeedback update(GeConTouristTrafficFeedback geConTouristTrafficFeedback) {
        this.geConTouristTrafficFeedbackDao.update(geConTouristTrafficFeedback);
        return this.queryById();
    }

    /**
     * 通过主键删除数据
     *
     * @param 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById() {
        return this.geConTouristTrafficFeedbackDao.deleteById() > 0;
    }

    @Override
    public boolean deleteByTrafficId(int id) {
        return this.geConTouristTrafficFeedbackDao.deleteByTrafficId(id) > 0;
    }
}
